using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DataModels.Models
{
    public partial class ExcelTemplateCell : ICloneable
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int CellID { get; set; }

        public int SheetID { get; set; }
        [ForeignKey("SheetID")]
        public virtual ExcelTemplateSheet ExcelTemplateSheet { get; set; }

        public Nullable<int> CellRowIndex { get; set; }
        public Nullable<int> CellColumnIndex { get; set; }

        [StringLength(1000)]
        public string IndicatorDataSource { get; set; }

        [StringLength(1000)]
        public string ColumnHeader { get; set; }

        [StringLength(1000)]
        public string RowHeader { get; set; }

        public int ColumnHeaderIndex { get; set; }
        public int RowHeaderIndex { get; set; }

        [StringLength(50)]
        public string CellAddress { get; set; }

        public virtual List<ExcelTemplateCellExtra> ExcelTemplateCellExtras { get; set; }

        public object Clone()
        {
            var clone = new ExcelTemplateCell();
            clone.CellRowIndex = this.CellRowIndex;
            clone.CellColumnIndex = this.CellColumnIndex;
            clone.IndicatorDataSource = this.IndicatorDataSource;
            clone.ColumnHeader = this.ColumnHeader;
            clone.RowHeader = this.RowHeader;
            clone.ColumnHeaderIndex = this.ColumnHeaderIndex;
            clone.RowHeaderIndex = this.RowHeaderIndex;
            clone.CellAddress = this.CellAddress;
            if (this.ExcelTemplateCellExtras != null)
            {
                clone.ExcelTemplateCellExtras = new List<ExcelTemplateCellExtra>();
                foreach (var e in this.ExcelTemplateCellExtras)
                {
                    var extra = (ExcelTemplateCellExtra)e.Clone();
                    clone.ExcelTemplateCellExtras.Add(extra);
                }
            }

            return clone;
        }
    }
}
